<?php
namespace common\components;
use yii;

class ActiveForm extends \yii\widgets\ActiveForm
{
	/**
	 * 重写form表单的初始化方法
	 * @param array $config
	 * @return Widget
	 * @throws yii\base\InvalidConfigException
	 */
	public static function begin($config = [
		'options' => [
			'class' => 'form-horizontal',
		],
		'fieldConfig' => [
			'template' => "{label}\n<div class=\"col-xs-5\">{input}</div>\n{hint}\n{error}",
		]
	])
	{
		$config['class'] = get_called_class();
		/* @var $widget Widget */
		$widget = Yii::createObject($config);
		static::$stack[] = $widget;

		return $widget;
	}
}

